import request from '@/utils/http'
import request2 from '@/utils/uploadHttp'
// import qs from 'qs'

export function dict (params) {
  return request({
    url: '/commonDataInfo/dict',
    method: 'GET',
    params
  })
}

export function areaDict (params) {
  return request({
    url: '/commonDataInfo/areaDict',
    method: 'GET',
    params
  })
}

export function addForm (params) {
  return request({
    url: '/commonDataInfo/add',
    method: 'POST',
    data: params,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export function updateForm (params) {
  return request({
    url: '/commonDataInfo/update',
    method: 'POST',
    data: params,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export function pageList (params) {
  return request({
    url: '/commonDataInfo/pageList',
    method: 'GET',
    params
  })
}

export function commonDataInfoDetail (params) {
  return request({
    url: '/commonDataInfo/detail/' + params,
    method: 'GET'
  })
}

export function alarmDataInfoList (params) {
  return request({
    url: '/alarmdatainfo/alarmDataInfoList',
    method: 'POST',
    data: params,
    headers: {
      'Content-Type': 'application/json' // 设置为JSON格式
    }
  })
}

export function exportCommonDataInfo (params) {
  return request2({
    url: '/commonDataInfo/exportCommonDataInfo',
    method: 'GET',
    params,
    responseType: 'blob'
  })
}

export function downloadTemplate (params) {
  return request2({
    url: '/commonDataInfo/downloadTemplate',
    method: 'GET',
    params,
    responseType: 'blob'
  })
}

export function uploadCommonDataInfo (params) {
  return request2({
    url: '/commonDataInfo/uploadCommonDataInfo',
    method: 'POST',
    data: params,
    headers: {
      'Content-Type': 'multipart/form-data' // 设置为JSON格式
    }
  })
}